package com.cardone.validator;

import org.springframework.beans.factory.InitializingBean;

import java.util.List;

/**
 * Created by Administrator on 2014/10/30.
 */
public class ValidatorRuleConfig implements InitializingBean {
    @lombok.Setter
    @lombok.Getter
    private String name;

    /**
     * 验证类型
     */
    @lombok.Setter
    @lombok.Getter
    private Class<?> valueClass;

    /**
     * 验证类型对象
     */
    @lombok.Setter
    @lombok.Getter
    private Object valueClassObject;

    @lombok.Setter
    @lombok.Getter
    private Object value;

    @lombok.Setter
    @lombok.Getter
    private Object overrideValue;

    @lombok.Setter
    @lombok.Getter
    private List<ValidatorRule> validatorRuleList;

    @lombok.Setter
    @lombok.Getter
    private List<ValidatorRuleConfig> children;

    @Override
    public void afterPropertiesSet() throws Exception {
        if (valueClass != null) {
            return;
        }

        if (valueClassObject == null) {
            return;
        }

        valueClass = valueClassObject.getClass();
    }
}
